#include "mainwindow.h"
#include "appinit.h"
#include <QFile>
#include <QApplication>

int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
    QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);

    QApplication a(argc, argv);
    MainWindow *w = new MainWindow;
    w->show();
    // 获取屏幕的几何信息
    QRect screenRect = QGuiApplication::primaryScreen()->geometry();

    // 计算弹窗的中心位置
    int x = (screenRect.width() - w->width()) / 2;
    int y = (screenRect.height() - w->height()) / 2;

    // 设置弹窗的位置
    w->move(x, y);

    //加载样式表
    QFile file(":/new/prefix1/qss/psblack.css");
    if (file.open(QFile::ReadOnly)) {
        QString qss = QLatin1String(file.readAll());
        QString paletteColor = qss.mid(20, 7);
        qApp->setPalette(QPalette(QColor(paletteColor)));
        qApp->setStyleSheet(qss);
        file.close();
    }

    a.setFont(QFont("Microsoft Yahei", 9));
    AppInit::Instance()->start();


    return a.exec();



}
